import Vue from 'vue'
import VueRouter from 'vue-router'
import Basketball from '@/views/Basketball'
import Football from '@/views/Football'
import Swim from '@/views/Swim'
import Man from '@/views/second/Man'
import Woman from '@/views/second/Woman'
import Cba from '@/views/third/Cba'
import Nba from '@/views/third/Nba'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    redirect: '/football'
  },
  {
    path: '/basketball',
    component: Basketball,
    children: [
      {
        path: 'man',
        component: Man,
        children: [
          {
            path: 'cba',
            component: Cba
          },
          {
            path: 'nba',
            component: Nba
          }

        ]
      },
      {
        path: 'woman',
        component: Woman
      }
    ]
  },
  {
    path: '/football',
    component: Football
  },
  {
    path: '/swim',
    component: Swim
  }
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router